using System;
using System.Globalization;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System.Xml;
using System.Reflection;
using Services;
using Utilities.Menu.UIElements;
using BowMaster.Resources;
using BowMaster.SceneElements;

namespace BowMaster.Levels
{
    abstract class AppleTargetBase : ALevel
    {
        public Texture2D texture;
        public AppleTarget target;
        public AppleTargetBase(Game game, int index, String Name)
            : base(game, index, Name)
        {
            
        }

        protected override void LoadContent()
        {
            texture = Game.Content.Load<Texture2D>("Textures/appletarget");
            base.LoadContent();            
            
        }
        public override void DrawLevelElements()
        {
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            target.Draw(spriteBatch, view, projection);
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            base.DrawLevelElements();
            
            target.DrawHitBoxes(spriteBatch, view, projection, whiteBox);
        }
        public override void Update(GameTime gameTime)
        {

            if (activeArrow != null)
                if (target.Hitted(activeArrow))
                {
                    disabledArrows.Add(activeArrow);
                    activeArrow = null;
                    showGetBackButton = true;
                }
            if (target.appleHitted)
                LevelWon();
            if (target.life <= 0)
                LevelLost();
            base.Update(gameTime);
        }
    }
}
